class Preson{
    // 私有属性类型声明
    name: string
    age:number
    constructor(name:string, age:number = 18) {
        this.name = name
        this.age = age
    }
    say():void {
        console.log(this.name, this.age);
        
    }
}



let p1 = new Preson('张三',20)
// console.log(p1);
// p1.say()
// 2，继承
class Son extends Preson {
    skill: string
    constructor(name: string, age: number, skill: string) {
        super(name, age)
        this.skill =skill
    }
    info():void{
        console.log(this.name, this.age,this.skill);
        
    }
}

// let son = new Son('李四', 19, '哈哈哈')
// console.log(son)
// son.info()

/* 
    成员修饰符 : public 公开的 , protected 受保护的  private 私有的

*/
class Father{
    public name: string
    protected money: number
    private secret : string
    constructor(name: string, money: number, secret: string){
        this.name = name
        this.money = money
        this.secret = secret
    }

    say(): void {
        console.log('public', this.name);
        console.log('protected', this.money);
        console.log('private', this.secret);
        
    }
}

class Son1 extends Father{
    constructor(name: string, money:number, secret: string) {
        super(name,money,secret)
    }
    hello():void{
        console.log('public name', this.name);
        console.log('protected money',this.money);
        // console.log('private', this.secret);
        
        
    }
}

let son1 = new Son1('李四', 18, '乐呵呵')

console.log(son1);
son1.hello()







export {}